package kr.hkit.summary_java.erp;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;

import kr.hkit.myframework.db.ConnectionFactory;
import kr.hkit.myframework.db.DBProperties;
import kr.hkit.summary_java.dao.DaoInterface;
import kr.hkit.summary_java.dao.DepartmentDAO;
import kr.hkit.summary_java.erp.dto.Department;

public class TestMain {
	public static void main(String[] args) throws SQLException {
		String filePath = "dbcon.xml";
		String driver = "com.mysql.jdbc.Driver";
		String url = "jdbc:mysql://localhost:3306/erp";
		String user = "root";
		String password = "1111";
	
		DBProperties.savePropertis(filePath, driver, url, user, password);
		DBProperties.prnProperties(DBProperties.loadPropertis(filePath));
		
		Connection con = ConnectionFactory.getConnection();
		
		DaoInterface<Department> dao = new DepartmentDAO(con);
		
//		dao.insertItem(new Department(7, "디자인", 11));
//		dao.updateItemByNo(new Department(7, "디자인", 15));
		
//		dao.deleteItemByNo(new Department(7, "디자인", 15));
		
		Department dept = new Department();
		dept.setDeptNo(1);
		
		Department temp = dao.searchItem(dept);
		System.out.println(temp);
		
		
		
/*		ArrayList<Department> lists = dao.listItems();
		for(Department d: lists){
			System.out.println(d);
		}*/
		
		
	}
}
